package com.heima.article.controller;

import com.heima.article.entity.ApAuthor;
import com.heima.common.dto.ResponseResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.heima.article.service.IApAuthorService;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * APP文章作者信息表 前端控制器
 * </p>
 *
 * @author mcm
 * @since 2022-06-20
 */
@RestController
@RequestMapping("/api/v1/author")
@Api(tags = "APP文章作者信息表接口")
public class ApAuthorController{

    @Autowired
    private IApAuthorService apAuthorService;
    //    添加作者信息
    @PostMapping
    public ResponseResult<ApAuthor> saveApAuthor(@RequestBody ApAuthor apAuthor){
        return apAuthorService.saveApAuthor(apAuthor);

    }
    @GetMapping("/{id}")
    public ResponseResult<ApAuthor> getAuthorById(@PathVariable("id")Integer id){
        ApAuthor apAuthor=apAuthorService.getById(id);
        return ResponseResult.okResult(apAuthor);

    }


}
